//----------------------------------------------------------------------------
//  ,-.
// /_\___ ,   Ninja Framework
// '  ___\    (C) Riccardo Capra - http://riccar.do
//  //   \\
//----------------------------------------------------------------------------
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
//----------------------------------------------------------------------------

#ifndef NJ_SYNCHRONIZATION_STATS_H
#	define NJ_SYNCHRONIZATION_STATS_H

#	include "NjExample01.h"

	/// \brief Used to store synchronization stats
	class NjSynchronizationStats
	{
	public:
		enum Row
		{
			PLATFORM_SYNC_OBJECT,
			NJ_MUTEX,
			NJ_RECURSIVE_MUTEX,
			NJ_SEMAPHORE,
			NJ_RW_LOCK,
			NJ_RW_LOCK_READ,
			NJ_RW_LOCK_WRITE,
			NJ_EVENT,
			NJ_PULSE_EVENT,
			NJ_DUMMY_SYNC_OBJECT,
			TOT_ROWS
		};

		enum Column
		{
			CLASS_SIZE,
			CREATION,
			DESCTURCTION,
			METH_LOCK,
			METH_UNLOCK,
			METH_TRY_LOCK_SUCCESS,
			METH_TRY_LOCK_FAIL,
			METH_SET,
			METH_UNSET,
			METH_WAKE_ONE,
			METH_WAKE_ALL,
			METH_TRY_WAIT_SUCCESS,
			METH_TRY_WAIT_FAIL,
			TOT_COLUMNS
		};

		/// \brief Secords one statistics entry
		static void Store(Row eRow, Column eColumn, NjUint uCount, NjFloat fValue);

		/// \brief Dumps all statistics
		static void Dump();

	private:
		class Static;

		NJ_DISABLE_INSTANCE(NjSynchronizationStats);
	};

#endif // NJ_SYNCHRONIZATION_STATS_H
